![]() |
DoTranslateScrapProcPtr |
||||
Header: | TranslationExtensions.h | Carbon status: | Supported | |
Defines a pointer to a scrap translation callback function. Your scrap translation callback function translates a scrap from one format into another.
typedef ComponentResult(* DoTranslateScrapProcPtr) ( ComponentInstance self, TranslationRefNum refNum, const void *srcDataPtr, Size srcDataLength, ScrapType srcType, SInt32 srcTypeHint, Handle dstData, ScrapType dstType, SInt32 dstTypeHint );
You would declare your function like this if you were to name it MyDoTranslateScrapCallback:
ComponentResult MyDoTranslateScrapCallback ( ComponentInstance self, TranslationRefNum refNum, const void *srcDataPtr, Size srcDataLength, ScrapType srcType, SInt32 srcTypeHint, Handle dstData, ScrapType dstType, SInt32 dstTypeHint );
A component instance that identifies the component containing the translation extension.
The translation reference number for this translation.
Macintosh Easy Open assigns this reference number to the translation. Each translation is assigned a unique number to distinguish the translation from any other translations that might be occurring. You need to pass this reference number to any Macintosh Easy Open functions you call from within the scrap translation extension; for instance, if you display the progress dialog box by calling the SetTranslationAdvertisement function, you’ll pass that reference number in the refNum parameter.
A pointer to the scrap to translate.
The size of the scrap to translate.
The format of the scrap to translate.
The value in the hint field of the source document’s scrap type specification.
A handle to the destination to be filled in. Your function should put the translated data into the block specified here, resizing it as necessary.
The format into which to translate the source scrap.
The value in the hint field of the destination document’s scrap type specification.
If successful, your function should return noErr. Otherwise, your function should return an appropriate result code. The Component Manager requires this function to return a value of type ComponentResult to simplify dispatching.
A scrap translation extension must respond to the kTranslateTranslateScrap request code. You can handle this request by calling the Component Manager function CallComponentFunctionWithStorage and passing it a pointer to your function. Your scrap translation callback function can translate the source file itself or rely upon external translators.
Your translation extension should call the SetTranslationAdvertisement function to display the progress dialog box and the UpdateTranslationProgress function to update the dialog box periodically.
Supported in Carbon.
© 2000 Apple Computer, Inc. — (Last Updated 3/23/2000)